package cn.kone.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.kone.result.JSONResult;
import cn.kone.service.ICustomerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "乘客端微信注册", description = "乘客端微信注册的接口")
@RestController
@RequestMapping("/app/customer")
public class WeChatRegisterCustomerController {



    @Autowired
    private ICustomerService customerService;



    /**
     * 通过前端传递的Code获取openid完成微信注册
     * @param code
     * @return 将获取到的openid统一封装到JSONResult中返回给前端
     */
    @Operation(summary = "乘客端微信注册", description = "获取openid")
    @Parameter(name = "code", description = "获取openid", required = true)
    @GetMapping("/openid")
    @SaIgnore
    public JSONResult getOpenId(String code) {
        return JSONResult.success(customerService.getOpenId(code));
    }

}
